package jdklearning.concurrent.thread;



/**
 * @author shenenlu 2021年02月01日 上午10:11:01
 *
 */
public class WriteAndReadStaticValue {

    public static void main(String[] args) {
        new Thread(new A()).start();
        new Thread(new B()).start();
    }
}


class A implements Runnable{

    public static volatile int i = 0;

    @Override
    public void run() {
        while ( true ){
            System.out.println(i);
        }
    }
}


class B implements Runnable{

    @Override
    public void run() {
        A.i = 5;
    }
}

